package xaj.puiatti.ast;

import java.util.Iterator;
import java.util.List;

import polyglot.ast.Formal;
import polyglot.ast.Term;
import polyglot.ext.jl.ast.Term_c;
import polyglot.lex.Identifier;
import polyglot.util.CodeWriter;
import polyglot.util.Position;
import polyglot.visit.CFGBuilder;
import polyglot.visit.PrettyPrinter;

public class RuleCond_c extends Term_c implements RuleCond{

	private List pa;
    private Condic c;

    public RuleCond_c(Position pos, List pa, Condic c) {
        super(pos);
        this.pa = pa;
        this.c = c;
	}

	@Override
	public List acceptCFG(CFGBuilder v, List succs) {
        return null;
	}


	public List getFormals() {
        return pa;
    }

	@Override
	public Term entry() {
		// TODO Auto-generated method stub
		return null;
	}

	public void prettyPrint(CodeWriter w, PrettyPrinter tr){

        w.write(" advices( ");

    	for (Iterator i = pa.iterator(); i.hasNext(); ) {
    	    Identifier f = (Identifier) i.next();
    	    w.write(f.getIdentifier());

    	    if (i.hasNext()) {
    		w.write(",");
    		w.allowBreak(0, " ");
    	    }
    	}
        

        w.write(" ) ");
                
        if (c != null) {
            w.write("&& ");
            print(c,w,tr);
        }


    }
}
